﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ObligatorioBD.MerObjects
{
    public class CardinalEntity
    {
        Entity entity;
        string cardinality;
        public CardinalEntity(Entity entity, string cardinality)
        {
            this.cardinality = cardinality;
            this.entity = entity;
        }
        public Entity Entity
        {
            get { return this.entity; }
        }
        public string Cardinality
        {
            get { return this.cardinality; }
        }
    }
    public class Relationship : IAtributeObject, IObjectId
    {
        string name;
        int id = -1;
        List<Atribute> atributes;
        List<CardinalEntity> entities;
        public Relationship(string name)
        {
            this.name = name;
            this.atributes = new List<Atribute>();
            this.entities = new List<CardinalEntity>();
        }
        public void AddAtribute(Atribute atribute)
        {
            this.atributes.Add(atribute);
        }
        public void RemoveAtribute(Atribute atribute)
        {
            this.atributes.Remove(atribute);
        }
        public void AddEntity(Entity entity, string cardinality)
        {
            this.entities.Add(new CardinalEntity(entity, cardinality));
        }
        public List<Atribute> GetAtributes()
        {
            return this.atributes;
        }
        public List<CardinalEntity> GetEntities()
        {
            return this.entities;
        }
        public string Name
        {
            get { return this.name; }
        }
        public int ObjectId
        {
            get { return this.id; }
            set { this.id = value; }
        }
    }
}
